﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Control_Title_Text : System.Web.UI.UserControl
{
    MODEL.INewsClass MINC = new MODEL.INewsClass();
    MODEL.INewsClass _MINC = new MODEL.INewsClass();
    MODEL.NewsClass MNC = new MODEL.NewsClass();
    MODEL.NewsClass _MNC = new MODEL.NewsClass();
    MODEL.WebInfo MWI = new MODEL.WebInfo();
    MODEL.WebInfo _MWI = new MODEL.WebInfo();

    BLL.INewsClass BINC = new BLL.INewsClass();
    BLL.NewsClass BNC = new BLL.NewsClass();
    BLL.WebInfo BWI = new BLL.WebInfo();

    protected void Page_Load(object sender, EventArgs e)
    {
        ControlDataInit();
    }


    #region ControlDataInit
    protected void ControlDataInit()
    {
        try
        {
            string RawURL = Request.RawUrl;

            if ((RawURL.Contains("News.") && !RawURL.Contains("INews."))
                || (RawURL.Contains("NewsInfo.") && !RawURL.Contains("INewsInfo.")))
            {
                #region News
                if (!RawURL.Contains("?ClassID="))
                {
                    LB_TitleText.Text = "公司新闻";
                }
                else
                {
                    MNC.NC_ID = Convert.ToInt32(Request.QueryString["ClassID"]);

                    _MNC = BNC.GetDataByID(MNC);

                    LB_TitleText.Text = _MNC.NC_Title;
                }
                #endregion
            }
            else if (RawURL.Contains("Product.") || RawURL.Contains("ProductInfo."))
            {
                LB_TitleText.Text = "产品中心";
            }
            else if (RawURL.Contains("INews.") || RawURL.Contains("INewsInfo."))
            {
                #region INews
                if (!RawURL.Contains("?ClassID="))
                {
                    LB_TitleText.Text = "图文展示";
                }
                else
                {
                    MINC.INC_ID = Convert.ToInt32(Request.QueryString["ClassID"]);

                    _MINC = BINC.GetDataByID(MINC);

                    LB_TitleText.Text = _MINC.INC_Title;
                }
                #endregion
            }
            else if (RawURL.Contains("GBook."))
            {
                LB_TitleText.Text = "客户留言";
            }
            else if (RawURL.Contains("RegUsers."))
            {
                LB_TitleText.Text = "注册会员";
            }
            else if (RawURL.Contains("UserInfo."))
            {
                LB_TitleText.Text = "个人信息";
            }
            else if (RawURL.Contains("WebInfo."))
            {
                #region WebInfo
                MWI.WI_ID = Convert.ToInt32(Request.QueryString["WebInfoID"]);

                _MWI = BWI.GetDataByID(MWI);

                LB_TitleText.Text = _MWI.WI_Title;
                #endregion
            }
            else
            {
                throw new Exception("未定义文本档案");
            }
        }
        catch (Exception ex)
        {
            LB_TitleText.Text = ex.Message;
        }
    }
    #endregion

}
